Hey everyone,
void createCaption(DB box){
string whatisthis = get(captionfield)
print whatisthis
Object newo = create below createcapobj
newo."Paragraph Style" = "<Object Text:Caption-Figure>"
Buffer cap = create
Object par = parent createcapobj
while(par."Object Heading" "" ==""){
par = parent par
}
string parnum = number par
cap += "Figure " parnum "-" createcaprank "-" whatisthis
newo."Object Text" = cap
//release captionGUI
hide captionGUI
}
int createCapGUI(Object o){
string temp = createcapobj."Absolute Number"
captionframe = richText(captionGUI,"Create Caption","",600,300,true)
captionfield = field(captionGUI,"Caption Comment:","",50)
captionfield->"top"->"spaced"->captionframe
string s = richTextWithOle createcapobj."Object Text"
set(captionframe,s)
ok(captionGUI,"Create Caption",createCaption)
//show captionGUI
block captionGUI
return 1
}
wcheng - Fri Feb 12 19:16:22 EST 2010 |
Re: OLE Object in RichText Field
I am not sure, but I see the "Object o" parameter in the createCapGUI function is useless, since you always use the createcapobj in your functions. You did not post how you call the createCapGUI function, but if you do it like that:
for obj in current Module do {
if ( is_this_a_figure_check(obj) && does_it_need_a_caption_check(obj) ) {
createCapGUI obj
}
}
DB captionGUI = create "Create a caption dialog"
for obj in module do {
if (some checks) {
createcapobj = obj
// for the first call these functions will really create the dialog elements
// the second and following calls will overwrite the captionframe and captionfield
// variables.
captionframe = richText(captionGUI,"Create Caption","",600,300,true)
captionfield = field(captionGUI,"Caption Comment:","",50)
...
// on the first call this will set the right captionframe. On the second call
// captionframe will point to an invisible field that has not been added to the dialog
// box, since it was already realized at the time of its creation.
set(captionframe,s)
...
// this will realize the dialog box in the first iteration, meaning you cannot
// create any more elements in the dialog box after this call
block captionGUI
...
// this will just hide the dialog box, but if you call block again you will just show it again.
hide captionGUI
}
}
|